package com.jiyoukeji.template.config;

import com.jiyoukeji.template.interceptor.LoginInterceptor;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration
public class InterceptorRegisterConfig implements WebMvcConfigurer {

    /**
     * @Author: 李培洋
     * @Date: 2024/11/20 23:25
     * @Description: 添加拦截器(注册)
     */
    @Override
    public void addInterceptors(InterceptorRegistry registry) {

        //添加登录拦截器,用于校验Token
        registry.addInterceptor(new LoginInterceptor()).addPathPatterns("/**");
    }
}
